package net.tv90.bfmccore.unlock;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class UnlockCommand implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (label.equalsIgnoreCase("unlock")) {

            if (args.length == 0) {
                sender.sendMessage("/unlock <mainweapon|gadget> <player> <weaponId> <money>");
                sender.sendMessage("/unlock noob <player>");
            }

            switch (args[0].toLowerCase()){
                case "mainweapon":{
                    UnlockUtil.unlockMainWeapon(Bukkit.getPlayerExact(args[1]), args[2], Integer.parseInt(args[3]));
                    break;
                }
                case "gadget":{
                    UnlockUtil.unlockGadget(Bukkit.getPlayerExact(args[1]), args[2], Integer.parseInt(args[3]));
                    break;
                }
                case "noob":{
                    Player player = Bukkit.getPlayerExact(args[1]);
                    UnlockUtil.doNoobTutorial(player);
                    break;
                }
                default:{
                    break;
                }
            }

            return true;
        }
        return true;
    }
}
